<% content_for :heading do %>
  <h1><%= t "oauth.oauthorize.title" %></h1>
<% end %>

<p><%= raw t("oauth.oauthorize.request_access", :app_name => link_to(@token.client_application.name, @token.client_application.url), :user => link_to(@user.display_name, :controller => :user, :action => :view, :display_name => @user.display_name)) %></p>

<%= form_tag authorize_url do %>
  <%= hidden_field_tag "oauth_token", @token.token %>
  <%- if params[:oauth_callback] -%>
    <%= hidden_field_tag "oauth_callback", params[:oauth_callback] %>
  <%- end -%>
  <p><%= t 'oauth.oauthorize.allow_to' %></p>
  <ul style="list-style:none">
  <% @token.client_application.permissions.each do |perm| %>
    <li><%= check_box_tag perm.to_s, "yes", @token.read_attribute(perm) %><%= t "oauth.oauthorize.#{perm}" %></li>
  <% end %>
  </ul>
  <p><%= submit_tag t("oauth.oauthorize.grant_access") %></p>
<% end %>
